package com.hc.dao;

import com.hc.bean.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface UserDao {
    /*用户注册添加*/
    @Insert("insert into user(userId,userName,userPassword,userEmail,userRegisterTime) values(#{userId},#{userName},#{userPassword}," +
            "#{userEmail},#{userRegisterTime})")
    public Integer addUser(User user);

    /*查询所有用户*/
    @Select("select * from user")
    List<User> findAll();

    /*判断用户名是否已存在*/
    @Select("select * from user where userName=#{name}")
    List<User> isExitUserName(String name);

    /*验证用户账号密码是否正确*/
    @Select("select * from user where userName=#{userName} and userPassword=#{userPassword}")
    User identityUser(User user);

    /*根据用户id查询用户信息*/
    @Select("select * from user where userId=#{uid}")
    User getUserByUid(Integer uid);
}
